import http from '../../utils/request/request'

// 获取数据（分类）
export function getAllInfoByDate(page, size, data) {
    return http({
        url: `/breed/farming/option/${page}/${size}`,
        method: 'get',
        params: {
            baseName: data.baseName,
            farmingStatus: data.farmingStatus,
            overTime: data.overTime,
            startTime: data.startTime,
        }
    })
}
// 根据关键词搜索生产档案
export function searchProductionsKeyword(page, size, keyword) {
    return http({
        url: `/breed/farming/keyword/${page}/${size}`,
        method: 'get',
        params: {
            keyword: keyword
        }
    })
}

// 创建生产档案
export function newProduction(data) {
    return http({
        url: `/breed/farming`,
        method: 'post',
        data: data
    })
}

// 编辑生产档案
export function editProduction(data) {
    return http({
        url: `/breed/farming`,
        method: 'put',
        data: data
    })
}

// 删除多个生产档案
export function delProduction(ids) {
    return http({
        url: `/breed/farming/batch`,
        method: 'delete',
        data: ids
    })
}

// 删除单个生产档案
export function delOneProduction(id) {
    return http({
        url: `/breed/farming/${id}`,
        method: 'delete',
    })
}

// excel导出生产档案
export function excelPutoutOneProduction(fileName) {
    return http({
        url: `/breed/farming/excel/${fileName}`,
        method: 'post',
    })
}

// excel选择导出生产档案
export function excelPutoutSelProduction(name, data) {
    return http({
        url: `/breed/farming/option/excel/${name}`,
        method: 'post',
        data: data
    })
}

export function getColumns() {
    return [ // 表头
          {
            name: "养殖档案编号",
            show: true,
            prop: "id"
          },
          {
            name: "养殖开始时间",
            show: true,
            prop: "farmingTime"
          },
          {
            name: "基地",
            show: true,
            prop: "baseName"
          },
          {
            name: "产品SKU",
            show: true,
            prop: "productSkuNumber"
          },
          {
            name: "负责人",
            show: true,
            prop: "principalName"
          },
          {
            name: "养殖规模(只)",
            show: true,
            prop: "farmingAmount",
          },
          {
            name: "养殖状态",
            show: true,
            prop: "farmingStatus"
          },
          {
            name: "备注",
            show: true,
            prop: "remarks"
          },
          {
            name: "操作",
            show: true
          },
        ]
}
